home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
-
- # Include the cgi library from chapter 1.
-
- require "cgilib.pl";
-
- # Initialize some variables
-
- $data = "";
- %cgiDict;
- $theUrl = "";
- $title = "";
-
- #Print the content type
-
- print "Content-type: text/html\n\n";
-
- #Read the cgi input
-
- &readData(*data);
- &parseData(*data,*cgiDict);
-
- # Figure out which button was selected
-
- if($cgiDict{"choice"} eq "library")
- {
- $title = "CGI input library";
- open(in,"cgilib.pl");
- }
- else
- {
- $title = "dynhtm.pl script";
- open(in,"dynhtm.pl");
- }
-
- # output the HTML header
- print "<HTML>\n";
- print "<HEAD>\n";
-
-
- print "<TITLE>",$title,"</TITLE>\n";
-
-
- print "</HEAD>\n";
- print "<BODY>\n";
- print "<PRE>\n";
-
- while(<in>)
- {
- # Since this is file is treated as html,
- # get rid of restricted
- # characters. Do & first to avoid
- # recoding of <, ...
-
- s/&/&/g;
- s/</</g;
- s/>/>/g;
- s/\"/"/g;
-
- print $_;
- }
-
-
- close(in);
-
- # Output the html footer
- print "</PRE>\n";
- print "</BODY>\n";
- print "</HTML>\n";
-
- 1;
-
-